﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WordWonderGame.UI
{
    public partial class LoadingUI : Form
    {
        public event EventHandler LoadSuccess;
        public LoadingUI()
        {
            InitializeComponent();
        }

        private void LoadingUI_Load(object sender, EventArgs e)
        {
            timer1.Start();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (progressBar1.Value < 100)
            {
                progressBar1.Value = progressBar1.Value + 1;
                //progressBar1.PerformStep();
            }
            else
            {
                //progressBar1.Value = 0;
                timer1.Stop();
                timer2.Start();

            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            timer2.Stop();

            Close();
            if (LoadSuccess != null)
            {
                LoadSuccess(this, null);
            }
        }

    }
}
